package luogu;

import java.util.Arrays;
import java.util.Scanner;

public class P1308 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.nextLine();
        String t = sc.nextLine();
        String[] arr = t.split(" ");
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i].equalsIgnoreCase(s)){
                count++;
            }
        }
        if (count == 0){
            System.out.println(-1);
            return;
        }
        System.out.print(count + " ");
        int res = 0;
        for (int i = 0; i < arr.length; i++) {
            res += arr[i].length();
            if (arr[i].equalsIgnoreCase(s)){
                System.out.println(res - arr[i].length());
                break;
            }
            res++;
        }
    }
}
//tIXHUguyz PZYAJL  BIv NAPoemaJ aTF LOvhV m s LSa n xDn mQnO T ettIq T  AL  fG B Xme  t  fct U  tQ  d